<?php

//window 双击start_for_win.bat

/*linux
启动服务 php start.php start -d
停止服务 php start.php stop
服务状态 php start.php status*/

// 指明给谁推送，为空表示向所有在线用户推送
$to_uid = '';
// 推送的url地址，上线时改成自己的服务器地址
$push_api_url = "http://msg.cc:2121/";
$json_data = [
    'status' => 1,
    'msg'  => '测试数据'
];
$post_data = array(
    'type' => 'publish',
    'content' => json_encode($json_data),
    'to' => $to_uid,
    'status'=>1
);

$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $push_api_url );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data );
$return = curl_exec ( $ch );
curl_close ( $ch );
var_export($return);